package com.app.controller;


import com.app.model.ReportClassModel;
import com.app.service.ReportClassService;
import com.app.util.Result;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
@RestController
@Data
public class ReportClassController {

    @Autowired
    ReportClassService reportClassService;

    //查询举报分类
    @GetMapping("/getReportClassList")
    public Result<Object> getReportClassList(){
        List<ReportClassModel> modelList = reportClassService.getClassByLevel(1);
        for (int i = 0; i < modelList.size(); i++) {
            List<ReportClassModel> sonModelList = reportClassService.getClassByFatherId(modelList.get(i).getId());
            modelList.get(i).setModelList(sonModelList);
        }
        return Result.success(modelList);
    }



}